<template>
  <div class="SayingList">
      <h2>这是SayingList组件</h2>
      <ul>
          <li v-for="saying in SayingList" :key="saying.id">{{saying.title}}</li>
      </ul>
      <hr>
      <button @click="AddList">点击添加列表</button><br><br>
      <h2>学校的年龄:{{bigAge}}</h2>
  </div>
</template>

<script>
import {mapState,mapMutations,mapGetters} from 'vuex'
  export default {
    name:'SayingList',
    computed:{
        ...mapState(['School','SayingList']),
        ...mapGetters(['bigAge'])
    },
    methods:{
      // AddList(){
      //   this.$state.commit('ADD_LIST');
      // }
      ...mapMutations({AddList:'ADD_LIST'})
    }
  }
</script>

<style scoped>
  .SayingList{
      background:cornflowerblue;
      padding:30px;
  }
</style>